/**
 * @file rank/elementary/luogu1089/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/7 13:43:55
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main() {
  // High rating and good luck!
  int cur = 0;
  int save = 0;
  for (int i = 1; i <= 12; ++i) {
    cur += 300;
    int exp;
    cin >> exp;
    cur -= exp;
    if (cur < 0) {
      cout << -i << endl;
      return 0;
    }
    save += cur / 100;
    cur %= 100;
  }
  cout << save * 120 + cur << endl;
  return 0;
}
